# Maintainer: Alexey Pavlov <alexpux@gmail.com>

_realname=ncurses

pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=5.9
pkgrel=2
pkgdesc="System V Release 4.0 curses emulation library"
arch=('any')
depends=("${MINGW_PACKAGE_PREFIX}-libgnurx")
makedepends=("${MINGW_PACKAGE_PREFIX}-libgnurx" "${MINGW_PACKAGE_PREFIX}-gcc")
#groups=("${MINGW_PACKAGE_PREFIX}")
url="http://www.gnu.org/software/ncurses/"
license=('MIT')
options=('staticlibs' 'strip')
source=(http://ftp.gnu.org/pub/gnu/ncurses/${_realname}-${pkgver}.tar.gz)
md5sums=('8cb9c412e5f2d96bc6f459aa8c6282a1')

build() {
  cd ${srcdir}/$_realname-$pkgver

  CFLAGS+=" -D__USE_MINGW_ANSI_STDIO=1"
  ./configure \
    --prefix=${MINGW_PREFIX} \
    --build=${MINGW_CHOST} \
  --host=${MINGW_CHOST} \
    --without-ada \
  --with-cxx \
  --enable-pc-files \
  --disable-rpath \
  --enable-colorfgbg \
  --disable-symlinks \
  --enable-warnings \
  --enable-assertions \
  --disable-home-terminfo \
  --enable-database \
  --enable-sp-funcs \
  --enable-term-driver \
  --enable-interop \
  --enable-widec

  make
}

package() {
  cd ${srcdir}/$_realname-$pkgver
  make DESTDIR=${pkgdir} install
  cp -r ${pkgdir}${MINGW_PREFIX}/include/ncursesw ${pkgdir}${MINGW_PREFIX}/include/ncurses
  cp ${pkgdir}${MINGW_PREFIX}/lib/libncursesw.a ${pkgdir}${MINGW_PREFIX}/lib/libncurses.a
  rm -rf ${pkgdir}${MINGW_PREFIX}/man
}
